package org.leo.app;

import java.lang.annotation.*;

/**
 * @author qlx
 */
public class AnnotationTest {
    @MyAnnotation(name = "test")
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Annotation[] arrays = Class.forName("org.leo.app.Demo1").getMethod("main", String[].class).getAnnotations();
        for (Annotation annotation : arrays) {
            System.out.println(annotation);
        }
    }
}

/**
 * @author qlx
 */
@Target(value = {ElementType.METHOD})
@Retention(value =  RetentionPolicy.RUNTIME)
@interface MyAnnotation {
    String name();
    int age() default 0;
}
